package com.sc.byahi.user.client.components.maps;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;

public class InfoWindowOptions extends JavaScriptObject {

	/**
	 * used for the removal of the gwt widgets from the map
	 */
	private static MapPanel mapPanel;

	protected InfoWindowOptions() {
	}

	public static final InfoWindowOptions getInstance() {
		return JavaScriptObject.createObject().cast();
	}

	public final void setContent(Widget widget) {
		mapPanel = new MapPanel();
		mapPanel.add(widget);

		setContent(widget.getElement());
	}

	public final void clear() {
		mapPanel.clear();
	}

	public final native void setPosition(LatLng position) /*-{
		this.position = position;
	}-*/;

	/**
	 * set Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be
	 * sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size.
	 * 
	 * @param content
	 */
	public final native void setContent(String content) /*-{
		this.content = content;
	}-*/;

	/**
	 * set Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be
	 * sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size.
	 * 
	 * @param content
	 */
	public final native void setContent(Element content) /*-{
		this.content = content;
	}-*/;

}
